<html>
<head>
<title>MyLog Unit Test Page</title>
<style type="text/css" rel="stylesheet">

body {font-family: Arial}

</style>
<script type="text/javascript" src="chrome://mylog/content/test/ecmaunit.js"> </script>
<script language="JavaScript" type="text/javascript" src="chrome://mylog/content/mylog.js"></script>
<script language="JavaScript" type="text/javascript" src="chrome://mylog/content/mylog-datastorage.js"></script>
<script language="JavaScript" type="text/javascript" src="chrome://mylog/content/mylog-searchwindow.js"></script>
<script language="JavaScript" type="text/javascript" src="chrome://mylog/content/mylog-utility.js"></script>

<script type="text/javascript">
//<![CDATA[
    function MyLogTestCase() {
        this.name = 'MyLogTestCase';
        var handler,storage;
        this.setUp = function() {
            /* not in use here, didn't have to define it but this might be
        used as a reference
        */
            storage = new XmlDataStore();
            storage.setXmlFilepath("mylog-content-search-test.xml");
            handler = storage.open();
        };
    
        this.testSearch1 = function() {
            var keyword = "supercalifragilisticespialadocious";
            var searchType = "content";
           
            var returnList = handler.findEntries(keyword,searchType);
            this.assertEquals(returnList.length, 1);
        };
    
        this.testSearch2 = function() {
            var keyword = "mylog's";
            var searchType = "content";
          
            var returnList = handler.findEntries(keyword,searchType);
            this.assertEquals(returnList.length, 3);
        };
    
         this.testSearch3 = function() {
            var keyword = "zzzzzzzzzzzz";
            var searchType = "content";
         
            var returnList = handler.findEntries(keyword,searchType);
            this.assertEquals(returnList.length, 0);
        };
    
        this.testSearch4 = function() {
             var keyword = "";
            var searchType = "content";
         
            var returnList = handler.findEntries(keyword,searchType);
            this.assertEquals(returnList.length, 4);
        };
    
        this.testSearch5 = function() {
         	var keyword = "666";
            var searchType = "content";
         
            var returnList = handler.findEntries(keyword,searchType);
            this.assertEquals(returnList.length, 1);
        };
    
        this.tearDown = function() {
            /* not in use here, didn't have to define it but this might be
        used as a reference
        */
            storage.close(handler);
        };
    };    
    MyLogTestCase.prototype = new TestCase;

    function runTests() {
        placeholder = document.getElementById('placeholder');
        var testsuite = new TestSuite(new HTMLReporter(placeholder));
        testsuite.registerTest(MyLogTestCase);
        testsuite.runSuite();
    };
//]]>
</script>
</head>
<body onload="runTests()">
<h3>EcmaUnit tests for MyLog Search by content</h3>
<div id="placeholder"> </div>

</body>
</html>
